// INotifier.h: interface for the INotifier class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INOTIFIER_H__404E799A_0FF1_4B49_85A0_A750375C89EF__INCLUDED_)
#define AFX_INOTIFIER_H__404E799A_0FF1_4B49_85A0_A750375C89EF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "agentctlex.h"
#include "agentctlcharacterex.h"
#include "agentctlcharacters.h"
#include "agentctlcommandsex.h"
#include "agentctlcommand.h"
#include "agentctlrequest.h"
#include "agentctluserinput.h"

#include "afx.h"

#include <queue>
using namespace std;

#include "Configuration.h"

class INotifier  
{
public:
	virtual CTime GetNextNotifyTime(const CTime& now)=0;
	virtual void Notify(CAgentCtlCharacterEx* chacter)=0;
};

class CNotifyManager
{
public:
	virtual ~CNotifyManager();

	void AddNotifier(INotifier* pNotifier);
	void Update(CAgentCtlCharacterEx* pCharacter);

protected:
	struct TimeNotifier 
	{
		CTime time;
		INotifier* pNotifier;
	};

	struct TNLess
	{
		bool operator()(const TimeNotifier& tn1, const TimeNotifier& tn2)
		{
			return tn1.time>tn2.time;
		}
	};

	typedef priority_queue<TimeNotifier, vector<TimeNotifier>, TNLess> QTN;
	QTN m_TNs;
};

class CDrinkNotifier : public INotifier
{
public:
	virtual CTime GetNextNotifyTime(const CTime& now);
	virtual void Notify(CAgentCtlCharacterEx* pChacter);
};

class CPhysicalActiveNotifier : public INotifier
{
public:
	virtual CTime GetNextNotifyTime(const CTime& now);
	virtual void Notify(CAgentCtlCharacterEx* pChacter);
};

class CSleepNotifier : public INotifier
{
public:
	virtual CTime GetNextNotifyTime(const CTime& now);
	virtual void Notify(CAgentCtlCharacterEx* pChacter);

	CSleepNotifier(CConfiguration* pConfig)
		:m_pConfig(pConfig)
	{

	}
protected:
	CConfiguration* m_pConfig;
};



#endif // !defined(AFX_INOTIFIER_H__404E799A_0FF1_4B49_85A0_A750375C89EF__INCLUDED_)
